<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../../Template/generalTemplate.xhtml">



            <ui:define name="content">
                <h:form>
                    <p:panel id="rawMaterialRequirementList" header="Raw Material RequirementList" style="height:495px;">

                        <div style="margin-top:20px;margin-bottom:10px;"> 
                            <p:dataTable id="quotation" dynamic="true" emptyMessage="No raw material requirement." value="#{selectRawMaterialRequirementManagedBean.getRawMaterialRequirements()}" var ="o" paginator="true" rows="5">
                                <p:column filterBy="#{o.id}" filterMatchMode="contains" headerText="Requirement ID">
                                    #{o.id}
                                </p:column>


                                <p:column filterBy="#{o.dateGenerated}" filterMatchMode="contains" headerText="Date Generated">
                                    <h:outputText value="#{o.dateGenerated}">
                                        <f:convertDateTime pattern ="yyyy-MM-dd"/>
                                    </h:outputText>
                                </p:column> 

                                <p:column filterBy="#{o.forWeekStartingOn}" filterMatchMode="contains" headerText="For Week Commencing">
                                    <h:outputText value="#{o.forWeekStartingOn}">
                                        <f:convertDateTime pattern ="yyyy-MM-dd"/>
                                    </h:outputText>
                                </p:column>

                                <p:column headerText="Action" style="text-align: center;">    
                                    <p:commandButton image="ui-icon ui-icon-pencil" title="Proceed" action="#{selectRawMaterialRequirementManagedBean.createRawMaterialPurchasingOrder(o)}" />
                                </p:column>  

                            </p:dataTable>
                            </div>
                            <p:fieldset legend="View Ordered Raw Material Requirements" toggleable="true" toggleSpeed="500"  
                                        toggleListener="#{selectRawMaterialRequirementManagedBean.handleToggle}"  
                                        onToggleUpdate="rmList" collapsed="true" style="margin-top:20px;">  

                          <p:dataTable id="rmList" dynamic="true" emptyMessage="No raw material requirement." value="#{selectRawMaterialRequirementManagedBean.getAllRawMaterialRequirements()}" var ="o" paginator="true" rows="5">
                                <p:column filterBy="#{o.id}" filterMatchMode="contains" headerText="Requirement ID">
                                    #{o.id}
                                </p:column>


                                <p:column filterBy="#{o.dateGenerated}" filterMatchMode="contains" headerText="Date Generated">
                                    <h:outputText value="#{o.dateGenerated}">
                                        <f:convertDateTime pattern ="yyyy-MM-dd"/>
                                    </h:outputText>
                                </p:column> 

                                <p:column filterBy="#{o.forWeekStartingOn}" filterMatchMode="contains" headerText="For Week Commencing">
                                    <h:outputText value="#{o.forWeekStartingOn}">
                                        <f:convertDateTime pattern ="yyyy-MM-dd"/>
                                    </h:outputText>
                                </p:column>

                                <p:column headerText="Action" style="text-align: center;">    
                                    <p:commandButton image="ui-icon ui-icon-pencil" title="Proceed" action="#{selectRawMaterialRequirementManagedBean.createRawMaterialPurchasingOrder(o)}" />
                                </p:column>  

                            </p:dataTable>
 </p:fieldset> 
                        




                    </p:panel>
                </h:form>
            </ui:define>



        </ui:composition>

    </body>
</html>
